$(function () {
    // 特集商品 页面渲染
        $.ajax({
            type: "GET",
            url: "http://localhost:8888/public/ranking_list.json",
            dataType: "json",
            success: function (data) {
                render( data )
                //懒加载
                $('.lazy').lazyload()
            }
        })
        let frag_commodities_wrap2 = $('#frag-commodities-wrap2');
        function render(res) {
            frag_commodities_wrap2.append(res.ranking_list.map(item => 
                `<div class="frag-commodities-list-item">
                <div class="frag-commodities-item-image">
                    <img class='lazy' data-original="${item.img}" alt="">
                </div>
                <div class="frag-commodities-item-name">${item.goods_name}</div>
                <div class="frag-commodities-item-info">
                    <div class="frag-commodities-item-price">
                        <span class="DisplayPrice">￥
                            <span class="display-price-value highlight">
                                <span>${item.new_price}</span>
                            </span>
                            <span class="display-price-original">
                                <span>${item.old_price}</span>
                            </span>
                        </span>
                    </div>
                    <div class="frag-commodities-item-sales"> ${item.sales_num} </div>
                </div>
            </div>`
            ).join(""))
        };
    
    })